<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Estadísticas</title>
            <link rel="stylesheet" type="text/css" href="../css/view.css" media="all">
                <script type="text/javascript" src="./css/view.js"></script>

                </head>
                <body id="main_body" >

                    <img id="top" src="../css/top.png" alt="">
                        <div id="form_container">

                            <h1 align="center"><a>Administración</a></h1>
                            <form id="form_486725" class="appnitro"  method="post" action="grafico.php">
                                <div class="form_description">
                                    <h2 align="center">Administración</h2>
                                    <p align="center">Bienvenido al panel de administración.</p>
                                    <p align="center">Seleccione la opción que desee revisar.</p>
                                    <p align="center">Profesor: <?php $nombre = $_GET['nombre'] . " " . $_GET['apellido']; echo $nombre;?></p>
                                </div>						
                                <ul >
                                    <?
                                    $DB_NAME = 'tesis';
                                    $DB_HOST = 'localhost';
                                    $DB_USER = 'gach';
                                    $DB_PASS = 'gach18942bakuryu';

                                    $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);

                                    if (mysqli_connect_errno()) {
                                        printf("Connect failed: %s\n", mysqli_connect_error());
                                        exit();
                                    }
                                    $cedula = intval($_GET['cedula']);
                                    $query = "SELECT DISTINCT idmateria FROM tesis.puntos_grafico";

                                    $res = $mysqli->multi_query($query) or die($mysqli->error . __LINE__);

                                    $materias = array();

                                    if ($res) {

                                        do {
                                            if ($result = $mysqli->store_result()) {
                                                while ($row = $result->fetch_row()) {
                                                    array_push($materias, $row);

                                                    ;
                                                }
                                                $result->close();
                                            }
                                        } while ($mysqli->next_result());
                                    }

                                    $secciones = array();
                                    $query2 = "SELECT DISTINCT idseccion FROM tesis.puntos_grafico";
                                    $res2 = $mysqli->multi_query($query2) or die($mysqli->error . __LINE__);
                                    if ($res2) {

                                        do {
                                            if ($result2 = $mysqli->store_result()) {
                                                while ($row2 = $result2->fetch_row()) {
                                                    array_push($secciones, $row2);

                                                    ;
                                                }
                                                $result2->close();
                                            }
                                        } while ($mysqli->next_result());
                                    }

                                    $estadisticas = array();
                                    $query3 = "SELECT DISTINCT nom_descripcion FROM tesis.nombre_grafico";
                                    $res3 = $mysqli->multi_query($query3) or die($mysqli->error . __LINE__);
                                    if ($res3) {

                                        do {
                                            if ($result3 = $mysqli->store_result()) {
                                                while ($row3 = $result3->fetch_row()) {
                                                    array_push($estadisticas, $row3);

                                                    ;
                                                }
                                                $result3->close();
                                            }
                                        } while ($mysqli->next_result());
                                    }

                                    $preguntas = array();
                                    $query4 = "SELECT DISTINCT idpregunta FROM tesis.puntos_grafico";
                                    $res4 = $mysqli->multi_query($query4) or die($mysqli->error . __LINE__);
                                    if ($res4) {

                                        do {
                                            if ($result4 = $mysqli->store_result()) {
                                                while ($row4 = $result4->fetch_row()) {
                                                    array_push($preguntas, $row4);

                                                    ;
                                                }
                                                $result4->close();
                                            }
                                        } while ($mysqli->next_result());
                                    }



                                    $mysqli->close();
                                    ?>

                                    <li id="li_1" >
                                        <label class="description" for="element_1">Materias </label>
                                        <div>

                                            <select class="element select medium" id="element_1" name="element_1"> 
                                                <option value="" selected="selected"></option>

                                                <?
                                                for ($i = 0; $i < count($materias); $i++) {
                                                    ?>


                                                    <option  value="<?= $materias[$i][0] ?>" > <?= $materias[$i][0] ?></option>
                                                    <?
                                                }
                                                ?>

                                            </select>
                                        </div> 
                                    </li>


                                    <li id="li_2" >
                                        <label class="description" for="element_2">Sección </label>
                                        <div>                                            
                                            <select class="element select medium" id="element_2" name="element_2"> 
                                                <option value="" selected="selected"></option>
                                                <?
                                                for ($i = 0; $i < count($secciones); $i++) {
                                                    ?>


                                                    <option  value="<?= $secciones[$i][0] ?>" > <?= $secciones[$i][0] ?></option>
                                                    <?
                                                }
                                                ?>
                                            </select>
                                        </div> 
                                    </li>
                                    <li id="li_3" >
                                        <label class="description" for="element_3">Estadisticas </label>
                                        <div>
                                            <select class="element select medium" id="element_3" name="element_3"> 
                                                <option value="" selected="selected"></option>
                                                <?
                                                for ($i = 0; $i < count($estadisticas); $i++) {
                                                    ?>


                                                    <option  value="<?= $estadisticas[$i][0] ?>" > <?= $estadisticas[$i][0] ?></option>
                                                    <?
                                                }
                                                ?>

                                            </select>
                                        </div> 
                                    </li>

                                    <li id="li_4" >
                                        <label class="description" for="element_4">Pregunta </label>
                                        <div>
                                            <select class="element select medium" id="element_4" name="element_4"> 
                                                <option value="" selected="selected"></option>
                                                <?
                                                for ($i = 0; $i < count($preguntas); $i++) {
                                                    ?>


                                                    <option  value="<?= $preguntas[$i][0] ?>" > <?= $preguntas[$i][0] ?></option>
                                                    <?
                                                }
                                                ?>

                                            </select>
                                        </div> 
                                    </li>

                                    <li class="buttons" >
                                        <input type="hidden" name="form_id" value="486725" />

                                        <input  id="saveForm" class="button_text" type="submit" name="submit" value="Graficar" />
                                    </li>
                                </ul>
                            </form>	
                            <div id="footer">
                                Sistema de Evaluación Docente <a href="http://www.ucab.edu.ve">UCAB</a>
                            </div>
                        </div>
                        <img id="bottom" src="../css/bottom.png" alt="">
                            </body>
                            </html>
